<?php


namespace app\api\controller;


use app\api\BaseController;

class ExportModel extends BaseController
{
    public function punterExportModel()
    {
        $title = [
            'name' => '客户名称',
            'code' => '纳税编码',
            'registAdd' => '注册地址',
            'phoneNum' => '注册电话',
            'bank' => '开户行',
//            'bankName' => '银行账户',
            'bankCard' => '银行账户',
            'bankNum' => '银行行号',
            'saleIds' => '销售员id(多个用,隔开)',
            'contarct' => '联系人',
            'contarctAdd' => '联系地址',
            'contarctPhone' => '联系人电话',
            'saveUser' => '收货人',
            'saveAdd' => '收货地址',
            'savePhone' => '收货电话',
            'saveAddType' => '收货地址类型',
        ];
        $name = '客户导入模板';
        $list = [[
            'name' => '客户名称',
            'code' => '纳税编码',
            'registAdd' => '注册地址',
            'phoneNum' => '13131313311',
            'bank' => '开户行',
//            'bankName' => '银行账户',
            'bankCard' => '621001010011110001',
            'bankNum' => '132465',
            'saleIds' => '1,2,3',
            'contarct' => '联系人',
            'contarctAdd' => '联系地址',
            'contarctPhone' => '13232323322',
            'saveUser' => '收货人',
            'saveAdd' => '收货地址',
            'savePhone' => '13313131133',
            'saveAddType' => '收货地址类型',
        ]];
        exportXlsData($name, $title, $list);
        exit();
    }

    public function supplierExportModel()
    {
        $title = [
            'name' => '供应商名称',
            'code' => '纳税编码',
            'registAdd' => '注册地址',
            'phoneNum' => '注册电话',
            'bank' => '开户行',
//            'bankName' => '银行账户',
            'bankCard' => '银行卡号',
            'contarct' => '联系人',
            'contarctAdd' => '联系地址',
            'contarctPhone' => '联系人电话',
        ];
        $name = '供应商导入模板';
        $list = [[
            'name' => '供应商名称',
            'code' => '纳税编码',
            'registAdd' => '注册地址',
            'phoneNum' => '13232323312',
            'bank' => '开户行',
//            'bankName' => '银行账户',
            'bankCard' => '621000001',
            'contarct' => '联系人',
            'contarctAdd' => '联系地址',
            'contarctPhone' => '13132313321',
        ]];
        exportXlsData($name, $title, $list);
        exit();
    }

    public function nicheClueExportModel()
    {
        $title = [
            'punterName' => '客户名称',
            'contactName' => '线索联系人姓名',
            'contactPhone' => '线索联系人电话',
            'contactJob' => '线索联系人职位',
            'gTime' => '沟通时间',
            'content' => '线索内容',
            'applane' => '后续跟进计划',
            'fzId' => '负责人Id',
        ];
        $list = [[
            'punterName' => '客户名称',
            'contactName' => '张三',
            'contactPhone' => '13131313311',
            'contactJob' => '总监',
            'gTime' => '2024-12-01 12:34:56',
            'content' => '线索内容',
            'applane' => '后续跟进计划',
            'fzId' => '1',
        ]];
        $name = '商机线索模板';
        exportXlsData($name, $title, $list);
        exit();
    }

    public function QuotationOrderImportModel()
    {
        $title = [
            'punterId' => '客户Id',
            'salesUnitId' => '销售单位ID',
            'saleId' => '销售员ID',
            'tax' => '税率(%)',
            'contactId' => '联系人ID',
            'saveId' => '收货人ID',
            'orderDate' => '单据日期',
            'mdId' => '物料ID',
            'bjNum' => '报价数量',
            'bjPrice' => '报价单价',
            'discount' => '折扣(%)',
            'bjTime' => '报价货期',
            'remark' => '报价备注',
            'timeLong' => '有效天数',
        ];
        $list = [[
            'punterId' => '1',
            'salesUnitId' => '1',
            'saleId' => '2',
            'tax' => '10',
            'contactId' => '1',
            'saveId' => '2',
            'orderDate' => '2020-01-01',
            'mdId' => '1',
            'bjNum' => '1',
            'bjPrice' => '12',
            'discount' => '10',
            'bjTime' => '2020-01-01',
            'remark' => '报价备注',
            'timeLong' => '10',
        ]];
        $name = '报价导入模板';
        exportXlsData($name, $title, $list);
        exit();
    }

    public function QuotationOrderMxImportModel()
    {
        $title = [
            'specs' => '规格型号',
        ];
        $list = [[
            'specs' => 'testSpecs001',
        ]];
        $name = '销售报价明细导入模板';
        exportXlsData($name, $title, $list);
        exit();

}
    public function SaleContractImportModel()
    {
        $title = [
            'punterId' => '客户Id',
            'salesUnitId' => '销售单位ID',
            'saleId' => '销售员ID',
            'tax' => '税率(%)',
            'contactId' => '联系人ID',
            'saveId' => '收货人ID',
            'orderDate' => '单据日期',
            'mdId' => '物料ID',
            'bjNum' => '合同数量',
            'bjPrice' => '合同单价',
            'bjTime' => '合同货期',
            'proCode' => '项目编码',
            'quotationOderNum' => '关联报价单号',
            'quotationDetailId' => '报价单明细ID',
            'remark' => '产品备注',
        ];
        $list = [[
            'punterId' => '1',
            'salesUnitId' => '1',
            'saleId' => '2',
            'tax' => '10',
            'contactId' => '1',
            'saveId' => '2',
            'orderDate' => '2020-01-01',
            'mdId' => '1',
            'bjNum' => '1',
            'bjPrice' => '12',
            'proCode' => 'bm00001',
            'bjTime' => '2020-01-01',
            'remark' => '报价备注',
            'quotationOderNum' => 'BJ20241206000002',
            'quotationDetailId' => '5',
        ]];
        $name = '销售合同导入模板';
        exportXlsData($name, $title, $list);
        exit();
    }

    public function SaleContractMxImportModel()
    {
        $title = [
            'specs' => '型号',
            'bjNum' => '数量',
            'bjPrice' => '含税单价',
            'disAmount' => '优惠金额',
            "bjTime"=>'货期',
            "khlh"=>'客户料号',
            "proCode"=>'项目编码',
            "remark"=>'备注',
        ];
        $list = [[
            'specs' => '测试1',
            'bjNum' => '1',
            'bjPrice' => '10',
            'disAmount' => '10',
            "bjTime"=>'这是货期',
            "khlh"=>'这是客户料号',
            "proCode"=>'这是项目编码',
            "remark"=>'这是备注',
        ]];
        $name = '销售合同明细导入模板';
        exportXlsData($name, $title, $list);
        exit();
}
    public function SaleOutImportModel()
    {
        $title = [
            'punterId' => '客户Id',
            'saveId' => '收货人ID',
            'mdId' => '物料ID',
            'wId' => '仓库ID',
            'num' => '数量',
            'saleContractOrder' => '销售合同单号',
            'saleContractDetailId' => '销售合同明细ID',
            'kdCompany' => '快递公司',
            'kdOrderNum' => '快递单号',
        ];
        $list = [[
            'punterId' => '1',
            'saveId' => '2',
            'mdId' => '1',
            'wId' => '1',
            'num' => '20',
            'saleContractOrder' => 'XS20241209000002',
            'saleContractDetailId' => '8',
            'kdCompany' => '快递公司',
            'kdOrderNum' => 'KDH00001',
        ]];
        $name = '销售出库导入模板';
        exportXlsData($name, $title, $list);
        exit();
    }

    public function SaleRefundImportModel()
    {
        $title = [
            'punterId' => '客户Id',
            'wId' => '仓库ID',
            'num' => '数量',
            'saleContractDetailId' => '销售合同明细ID',
        ];
        $list = [[
            'punterId' => '1',
            'wId' => '1',
            'num' => '10',
            'saleContractDetailId' => '8',
        ]];
        $name = '销售退货导入模板';
        exportXlsData($name, $title, $list);
        exit();
    }

    public function BuyContractImportModel()
    {
        $title = [
            'punterId' => '供应商Id',
            'tax' => '税率(%)',
            'isTax' => '是否含税(1:是2：否)',
            'contactId' => '联系人ID',
            'bjNum' => '数量',
            'bjPrice' => '单价',
            'saleContractDetailId' => '关联销售合同明细ID',
            'remark' => '备注',
        ];
        $list = [[
            'punterId' => '6',
            'tax' => '10',
            'isTax' => '1',
            'contactId' => '3',
            'bjNum' => '10',
            'bjPrice' => '10',
            'saleContractDetailId' => '8',
            'remark' => '备注',
        ]];
        $name = '采购合同导入模板';
        exportXlsData($name, $title, $list);
        exit();
    }

    public function buyContractMxImportModel()
    {
        $title = [
            'specs' => '型号',
            'num' => '数量',
            'price' => '含税单价',
            'remark' => '备注',
            'bjTime' => '货期',
        ];
        $list = [[
            'specs' => '测试1',
            'num' => '1',
            'price' => '1',
            'remark' => '这是备注',
            'bjTime' => '这是货期',
        ]];
        $name = '采购明细导入模板';
        exportXlsData($name, $title, $list);
        exit();
}
    public function BuyInImportModel()
    {
        $title = [
            'punterId' => '供应商',
            'wId' => '仓库ID',
            'num' => '数量',
            'saleContractDetailId' => '采购合同明细ID',
        ];
        $list = [[
            'punterId' => '6',
            'wId' => '1',
            'num' => '50',
            'saleContractDetailId' => '13',
        ]];
        $name = '采购入库导入模板';
        exportXlsData($name, $title, $list);
        exit();
    }

    public function BuyRefundImportModel()
    {
        $title = [
            'punterId' => '供应商Id',
            'wId' => '仓库ID',
            'num' => '数量',
            'saleContractDetailId' => '采购合同明细ID',
        ];
        $list = [[
            'punterId' => '1',
            'wId' => '1',
            'num' => '10',
            'saleContractDetailId' => '17',
        ]];
        $name = '采购退货导入模板';
        exportXlsData($name, $title, $list);
        exit();
    }
}